#include <my_head.h>

void getsalt(const char *str, char *salt){
    int count = 0;
    const char *p = str;
    while(*p && count < 4){
        if(*p == '$'){
            count++;
        }
        p++;
    }
    if(count == 4){
        strncpy(salt, str, p - str);
        salt[p - str] = '\0';
    }
    else{
        salt[0] = '\0';
    }
}


int main() {
    char str[] = "$y$j9T$GLPvd3Xp3JPPX89vpBwbU0$TCsfApjqfREJ76oR9yyzEot976JzZ8KxuIPiLb4ee0.";
    
    char salt[1024] = {0};
    getsalt(str, salt);

    printf("%s\n", salt);
    return 0;
}
